package com.snopy.function;

import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;

/**
 * @author snopy
 * @version 1.0.0
 * @classname Demostration
 * @description
 * @email 77912204@qq.com
 * @date 2022/08/14 11:19
 */
@Slf4j
public class Demostration {
    public static void main(String[] args) {
        //栗子1
        Function<List<String>,List<String>> function = list -> {
            list.removeIf(s -> s.contains("hello"));
            return list;
        };
        Supplier<List<String>> supplier = ()->{
            List<String> list = new ArrayList<>();
            list.add("hello");
            list.add("world");
            list.add("hello!");
            list.add("hello world!");
            return list;
        };

        List<String> apply = function.apply(supplier.get());
        log.info("list:{}",apply);

    }

}
